package UseIO.Practice;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileCopy {
    public static void main(String[] args) throws IOException {
        copyFast();
    }
    public static void copySlow() throws IOException{
        FileInputStream fInput = new FileInputStream("/Users/wukai/Movies/01-模块重新导入_recv.mp4");
        FileOutputStream fOutput = new FileOutputStream("8.内置模块/UseIO/copy.mp4");
        int b;
        while ((b=fInput.read())!= -1){
            fOutput.write(b);
        }
        // 先开先关
        fInput.close();
        fOutput.close();
    }

    public static void copyFast() throws IOException{
        FileInputStream fInput = new FileInputStream("/Users/wukai/Movies/01-模块重新导入_recv.mp4");
        FileOutputStream fOutput = new FileOutputStream("8.内置模块/UseIO/copyFast.mp4");
        int b;
        byte[] bytes = new byte[1024 * 1024 * 5];
        while ((b=fInput.read(bytes))!= -1){
            fOutput.write(bytes,0,b);
        }
        // 先开先关
        fInput.close();
        fOutput.close();
    }
}

